Loading view does not suceed always

Hello dxl-developers,

 

I use following code in order to load a view in the current module m:

load(m, view(s_view_name), false).

 

At success this function returns true, otherwise false.

 

Now I have the strange problem, that sometimes it returns true, sometimes false.

Although the view to be loaded really exists in the module.

 

Did anybody ever had the same problem?


MarcoLuk - Mon Oct 02 09:15:25 EDT 2017

Re: Loading view does not suceed always
Mathias Mamsch - Mon Oct 02 19:12:24 EDT 2017

I think there is an Item parameter in the view perm, which you should set for safety purposes. So try: 

load(m, view(getItem m, s_view_name), false)

Just to make sure, that there is no "current Module" problem. I assume you have checked that the views s_view_name exist and that it does not yield any errors when loading. Regards, Mathias

Re: Loading view does not suceed always
smarti.sj - Tue Oct 03 07:38:12 EDT 2017

My understanding has been that in order to successfully load a view, the module must be open "viewable" /   Module m = read(modname, true). If you open the module and set the visibility to false you will get false returned by the load statement.

Regards

Sara

 

Re: Loading view does not suceed always
MarcoLuk - Wed Oct 04 03:44:55 EDT 2017

Mathias Mamsch - Mon Oct 02 19:12:24 EDT 2017

I think there is an Item parameter in the view perm, which you should set for safety purposes. So try: 

load(m, view(getItem m, s_view_name), false)

Just to make sure, that there is no "current Module" problem. I assume you have checked that the views s_view_name exist and that it does not yield any errors when loading. Regards, Mathias

Hello Mathias,

 

thank you very much for this useful Information.

I added "getItem m" in the view-function and it seems to work!

And yes, I use the current module (Module m = current).

Re: Loading view does not suceed always
MarcoLuk - Wed Oct 04 03:47:04 EDT 2017

smarti.sj - Tue Oct 03 07:38:12 EDT 2017

My understanding has been that in order to successfully load a view, the module must be open "viewable" /   Module m = read(modname, true). If you open the module and set the visibility to false you will get false returned by the load statement.

Regards

Sara

 

Hello Sara,

 

thank you too!

I determine the current module at script begin. If it is null, I abort further execution of dxl script.

The module is also visible, so that the solution proposal of Mathias with "getItem m" in the view-function

solves my problem.

Re: Loading view does not suceed always
MarcoLuk - Fri Oct 06 03:28:07 EDT 2017

MarcoLuk - Wed Oct 04 03:44:55 EDT 2017

Hello Mathias,

 

thank you very much for this useful Information.

I added "getItem m" in the view-function and it seems to work!

And yes, I use the current module (Module m = current).

Hello Mathias,

 

do you advice always to use add the "getItem(Module m)" to the view-function, regardless if the module is current or not?

 

Sincerely

Marco